package com.gljx.web.service.impl;

import com.gljx.web.Entity.Paytime;
import com.gljx.web.dao.CommonDao;
import com.gljx.web.dao.PaytimeMapper;
import com.gljx.web.service.PaytimeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by lcx on 2017/10/31.
 */
@Service
@Transactional
public class PaytimeServiceImpl extends CommonDao implements PaytimeService {


    @Autowired
    private PaytimeMapper paytimeMapper;

    /**
     * @Author lcx
     * @Date 2017/11/1 14:32
     * 查詢
     */
    @Override
    public List<Paytime> selectPaytime(String fcompanyid, String name) {
        return paytimeMapper.selectPayTime(fcompanyid, name);
    }


    /**
     * @Author lcx
     * @Date 2017/11/1 14:32
     * 添加
     */
    @Override
    public void addPayTime(Paytime paytime) {
        paytimeMapper.insertSelective(paytime);
    }

    /**
     * @Author lcx
     * @Date 2017/11/2 0002 下午 4:21
     * 按照id删除
     */
    @Override
    public void deleteByPrimaryKey(String fid) {
        paytimeMapper.deleteByPrimaryKey(fid);
    }

    /**
     * @Author lcx
     * @Date 2017/11/2 0002 下午 4:35
     * 修改
     */
    @Override
    public void modifyCarByFid(Paytime paytime) {
        paytimeMapper.updateByPrimaryKeySelective(paytime);
    }

    /**
     * @Author lcx
     * @Date 2017/11/3 0003 上午 9:42
     * 根据fid查询财务基础
     */
    @Override
    public Paytime queryPaytimeByFid(String fid) {
        return paytimeMapper.selectByPrimaryKey(fid);
    }


	@Override
    public List<Paytime> queryPayTime(String companyId) {
        // TODO Auto-generated method stub
        return paytimeMapper.selPayTime(companyId);
    }


	@Override
    public List<Paytime> queryPayTimeByName(String name, String companyId) {
        // TODO Auto-generated method stub
        Map<String, String> map = new HashMap<>();
        map.put("name", name);
        map.put("companyId", companyId);
        return paytimeMapper.selPayTimeByName(map);
    }


}
